package br.com.petrobrasrj.session;

import java.io.Serializable;
import java.util.List;

import javax.ejb.Local;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;

@Local
public interface IGenericSession<T> extends Serializable{

	@TransactionAttribute(TransactionAttributeType.REQUIRED)
	public abstract T save(T t) ;

	@TransactionAttribute(TransactionAttributeType.REQUIRED)
	public abstract T update(T t) ;

	@TransactionAttribute(TransactionAttributeType.REQUIRED)
	public abstract void delete(T t) ;


	@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
	public abstract T findById(Class<T> modelClass, Object id);
	
	@TransactionAttribute(TransactionAttributeType.REQUIRED)
	public abstract List<T> findAll(Class<T> modelClass);

}